import {defineStore} from 'pinia'
import {
    requestMarkingActivityDetail,
    requestMarkingActivityInfoSave,
    requestMarkingActivityInfoUpdate,
    requestMarkingActivityList,
    requestMarkingActivityStatusUpdate,
    MarkingActivityInfo,
    MarkingInfo,
    markingActivityStatus
} from '../service/activity'

// 活动管理
export default defineStore('useActivityStore', () => {

    // 活动详情
    const activityDetail = async (id: number) => {
        const res = await requestMarkingActivityDetail(id)
        // console.log(res, "| res");
        return res
    }

    // 查询活动列表
    const activityList = async (markingInfo: Partial<MarkingInfo>) => {
        const res = await requestMarkingActivityList(markingInfo)
        console.log(res, "| res");
    }

    // 新增活动
    const activityInfoSave = async (markingActivityInfo: Partial<MarkingActivityInfo>) => {
        const res = await requestMarkingActivityInfoSave(markingActivityInfo)
        console.log(res, "| res");
    }

    // 更新活动
    const activityInfoUpdate = async (markingActivityInfo: Partial<MarkingActivityInfo>) => {
        const res = await requestMarkingActivityInfoUpdate(markingActivityInfo)
        console.log(res, "| res");
    }

    // 更新活动状态
    const activityStatusUpdate = async (markingActivityStatus: Partial<markingActivityStatus>) => {
        const res = await requestMarkingActivityStatusUpdate(markingActivityStatus)
        console.log(res, "| res");
    }

    return {
        activityDetail,
        activityList,
        activityInfoSave,
        activityInfoUpdate,
        activityStatusUpdate
    }
})